home *** CD-ROM | disk | FTP | other *** search
- #{{{}}}
- #{{{ init defines
- BEGIN {
- FS="\t"
- doublequote=sprintf("%c",34)
- type ="#define LANGTYP "
- data ="#define LANGDATA "
- first=1
- # {{{ print auto-gen-mark
- print("/* This file is generated autmoatically by awk -f lg2h.awk */\n/* containing the predefined fold language types */")
- # }}}
- }
- #}}}
- $1!="#" {
- # {{{ LANGTYP
- type =type "FC_" substr($1,2,length($1)-2) ","
- # }}}
- # {{{ LANGDATA
- # {{{ id
- id=$1
- # }}}
- # {{{ start
- if (length($2)!=2) {
- start_txt="(unsigned char*)" $2
- start_lg ="sizeof("$2")-1"
- } else {
- start_txt="(unsigned char*)empty_text"
- start_lg ="0"
- }
- # }}}
- # {{{ end
- if (length($3)!=2) {
- end_txt="(unsigned char*)" $3
- end_lg ="sizeof("$3")-1"
- } else {
- end_txt="(unsigned char*)empty_text"
- end_lg ="0"
- }
- # }}}
- data=sprintf("%s\\\n LG_DAT(%s,%s,%s,%s,%s),",data,id,start_txt,start_lg,end_txt,end_lg)
- # }}}
- first=0
- }
- #{{{ print defines
- END {
- printf("%s\n%s\n",type,data)
- }
- #}}}
-